package com.itheima.student;
/** 电影操作类 */
public class MovieOperator5 {
    private Movie5[] movies;
    public MovieOperator5(Movie5[] movies) {
         this.movies = movies;
    }

    /** 显示全部电影信息 */
    public void printAllMoives() {
        System.out.println("--------系统全部电影信息如下：--------");
        for (int i = 0; i < movies.length; i++) {
            Movie5 m = movies[i];
            System.out.println("编号：" + m.getId());
            System.out.println("名称：" + m.getName());
            System.out.println("价格：" + m.getPrice());
            System.out.println("得分：" + m.getScore());
            System.out.println("----------------------------------");
        }
    }

    /** 电影ID搜索 */
    public void searchMovieById(int id) {
        for (int i = 0; i < movies.length; i++) {
            Movie5 m = movies[i];
            if (m.getId() == id) {
                System.out.println("--------该电影详情如下：--------");
                System.out.println("编号：" + m.getId());
                System.out.println("名称：" + m.getName());
                System.out.println("价格：" + m.getPrice());
                System.out.println("得分：" + m.getScore());
                System.out.println("导演：" + m.getDirector());
                System.out.println("其他信息：" + m.getInfo());
                System.out.println("-----------------------------");
                return;
            }
        }
        System.out.println("对不起，没有找到该电影的信息~");
    }
}
